<!DOCTYPE html>
{% load i18n static %}
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>管理员登录</title>
    <style>
/* 自定义登录页面样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: white;
}

.login-title {
    color: #333;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.login-subtitle {
    color: #666;
    font-size: 14px;
    margin: 0;
}

.login-form {
    margin-top: 30px;
}

.form-row {
    margin-bottom: 20px;
}

.form-row label {
    display: block;
    color: #333;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-row input[type="text"],
.form-row input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-row input[type="text"]:focus,
.form-row input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.submit-row {
    margin-top: 30px;
}

.submit-row input[type="submit"] {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.submit-row input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.errornote {
    background: #fff5f5;
    border-left: 4px solid #e53e3e;
    color: #c53030;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* 移动端响应式 */
@media (max-width: 480px) {
    .login-container {
        padding: 30px 20px;
        margin: 10px;
    }

    .login-title {
        font-size: 24px;
    }
}
    </style>
</head>
<body>
    <div class="page-wrapper">
        <div class="login-container">
            <div class="login-header">
                <div class="login-logo">
                    🚀
                </div>
                <h1 class="login-title">{{ site_header|default:_('Django管理后台') }}</h1>
                <p class="login-subtitle">请输入您的登录凭据</p>
            </div>

            {% if form.errors and not form.non_field_errors %}
                <div class="error">
                    <strong>请修正以下错误：</strong>
                    {% for field in form %}
                        {% if field.errors %}
                            {{ field.errors|striptags }}
                        {% endif %}
                    {% endfor %}
                </div>
            {% endif %}

            {% if form.non_field_errors %}
                <div class="errornote">
                    {{ form.non_field_errors|striptags }}
                </div>
            {% endif %}

            <form method="post" action="{{ app_path }}" class="login-form">
                {% csrf_token %}

                <div class="form-row">
                    <label for="{{ form.username.id_for_label }}">{{ form.username.label }}:</label>
                    {{ form.username }}
                </div>

                <div class="form-row">
                    <label for="{{ form.password.id_for_label }}">{{ form.password.label }}:</label>
                    {{ form.password }}
                </div>

                {% url 'admin_password_reset' as password_reset_url %}
                {% if password_reset_url %}
                <div class="login-footer">
                    <a href="{{ password_reset_url }}">忘记密码？</a>
                </div>
                {% endif %}

                <div class="submit-row">
                    <input type="submit" value="登录" />
                    <input type="hidden" name="next" value="{{ next }}" />
                </div>
            </form>

            <div class="login-footer">
                <small>© 2024 Django Admin 学习项目</small>
            </div>
        </div>
    </div>
</body>
</html>
